﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using System.IO;
using System.Drawing;

namespace COFE.Core.Validater
{
    /// <summary>
    /// Validate if PropertyPair's value is a valid filename.
    /// </summary>
    public class BitmapSizeAttribute : Attribute, IPropertyValidater 
    {
        public int Width { get; set; }
        public int Height { get; set; }

        public BitmapSizeAttribute(int width, int height)
        {
            Width = width;
            Height = height;
        }

        public void Verify(object value)
        {            
            Assert.IsNotNull(value);
            Assert.AreEqual(value.GetType(), typeof(Bitmap));                       
            Bitmap bitmap  = (value as Bitmap);

            if (Width != bitmap.Width || Height != bitmap.Height)
                throw new ArgumentException("Bitmap size does not match.");

        }
    }
}
